#include "operationfactory.h"

#include <string>
#include <iostream>
#include <stdexcept>

int main()
{
    using namespace std;
    try
    {
        cout << "Please input number A: " << endl;
        string numberA;
        cin >> numberA;
        cout << "Please select operator(+,-,*,/): " << endl;
        string sOperator;
        cin >> sOperator;
        cout << "Please input number B: " << endl;
        string numberB;
        cin >> numberB;
        Operation *operation = OperationFactory::createOperation(sOperator);
        cout << "Result of operation: "
             << operation->getResult(stod(numberA), stod(numberB))
             << endl;
        delete operation;
        operation = nullptr;
    }
    catch (const exception &e)
    {
        cerr << e.what() << '\n';
    }
}
